package com.example.spring_seatreservation.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.spring_seatreservation.entity.SeminarRoom;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SeminarRoomMapper extends BaseMapper<SeminarRoom> {

    @Select("select t.*,l.name as library_name,f.name as floor_name from seminar_room t " +
            "left join library l on l.id = t.lib_id " +
            "left join floor f on f.id = t.floor_id")
    List<SeminarRoom> getSeminarRoom();

    @Select("select count(1) from seminar_room where floor_id = #{floorId}")
    int selectRoomByFloorId(Long floorId);
}
